{{response.files.append(URL(r=request,c='static',f='js/jquery.dataTables.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='css/demo_table.css'))}}
{{extend 'layout.html'}}

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
    jQuery('.smarttable').dataTable({
        "iDisplayLength": 100,
        "aaSorting": []
    });
} );
</script>

<h1>Producer Messages</h1>

<!-- <button onclick="document.location='{{=URL(r=request,f='post_add')}}'">Create a New Message</button> -->

<div>
<table class="smarttable">
<thead>
<tr>
    <th>Timestamp</th>
    <th>Body</th>
    <th>Action</th>
</tr>
</thead>
<tbody>
{{for post in posts:}}
<tr>
    <td>{{=post.created_on}}</td>
    <td>{{=post.body}}</td>    
    <td>
    <a href="{{=URL(r=request,f='post_edit',args=post.id)}}">Edit</a>
    </td>
</tr>
{{pass}}
</tbody>
</table>
</div>
